package group2assignone.ucm.administrator;

import group2assignone.ucm.UCController;
import group2assignone.view.administrator.AdminMainView;
import group2assignone.dao.*;
import group2assignone.func.Authentication;
import group2assignone.model.*;
import group2assignone.ucm.UCStartup;
import group2assignone.view.OurView;
import java.lang.Object.*;
import java.util.*;

/**
 *public class UCUIAdminMainView implements UCController
 * this is the calss for the use case admin main view
 * it opens a view with a listing of all managers
 * @author group2
 */
public class UCUIAdminMainView implements UCController {

    private Administrator adm;
    private OurView view;
    private Authentication auth;
    private boolean ok;
    ArrayList<Manager> manList = new ArrayList<Manager>();
    private static final int list = 70;

     /**
     * Use Case: Administrator Main UI
     * Pre-Condition: MainView UI
     * Post-Condition: UI is updated
     * 1. System retrieves list of existing managers from database
     * 2. System creates Admin main view
     */
     @Override
    public void run() {
        //createDummyList();
        MyDAO coms = UCStartup.getInstance().getDAO();
        manList = coms.sQLGetAllFromManager();
        AdminMainView gui = new AdminMainView(manList);
        gui.go();
    }

    private void createDummyList() {
        for (int i = 0; i < list; i++) {
            Manager m = new Manager();
            m.setUsername("usernam" + i);
            m.setFName("fName" + i);
            m.setLName("lastNme" + i);
            m.setPassword("paswrdsss" + i);
            m.setDob("01/10/2001" + i);
            manList.add(m);
        }
    }
}
